/**
 * 
 */
package com.nextive.interview.activity.view;

import android.content.Context;
import android.view.View;
import android.widget.TextView;
import android.widget.ViewSwitcher.ViewFactory;

import static com.nextive.interview.ApplicationManager.getAppContext;
/**
 * Default class for text switcher's factory class. It creates a simple text view.
 * @author Cesar Roman
 *
 */
public class DefaultTextSwitcherFactory implements ViewFactory {

	/**
	 * Application's context.
	 */
	private Context context;
	
	/**
	 * Style to be applied to respective <code>TextView</code>.
	 */
	private Integer styleToApply;
	
	/**
	 * Unique constructor.
	 * @param style to be applied
	 */
	public DefaultTextSwitcherFactory(Integer style) {
		
		this.context = getAppContext();
		this.styleToApply = style;
		
	}

	/**
	 * In charge of building the text view.
	 * @return the text view
	 */
	@Override
	public View makeView() {
		
		TextView t = new TextView(context);
		if (styleToApply != null)
			t.setTextAppearance(context, styleToApply);
        return t;

	}

}
